import { feature, ENV } from '@alife/yunxiao-common';
import aliyun from './aliyun';
import vpc from './vpc';
import opensource from './opensource';

// 设置从 features/ 目录获取功能开关
export function initFeatures(env) {
  const features = {
    aliyun,
    vpc,
    opensource,
  };

  feature.setGetter((id) => {
    return features[env][id];
  });
}

export function getFeature(id) {
  return feature.get(id);
}

export function getENV() {
  return ENV.toLowerCase();
}